package com.stlm2.dems.entity.base;

import com.stlm2.dems.entity.*;

import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by apple on 2017/10/19.
 */
public class BasePurchaseOrder {

    /**
     * 唯一标识
     */
    private Integer id;

    /**
     * 下单用户
     */
    private Integer userId;

    /**
     * 订单编号
     */
    private String code;

    private BigDecimal totalMoney;

    private BigDecimal payMoney;
    private BigDecimal saveMoney;

    /**
     * 积分
     */
    private Integer integral;

    private Date createTime;

    private Date payTime;
    /**
     * 地址城市
     */
    private String city;
    /**
     * 经纬度
     */
    private String location;

    private String addressDetail;
    /**
     * 收货人
     */
    private String name;
    /**
     * 收货联系电话
     */
    private String phone;

    private OrderState orderState;

    private Date cancelTime;

    /**
     * 支付渠道
     */
    private PayChannel payChannel;
    /**
     * 交易流水号
     */
    private String transactionNo;

    /**
     * 支付方式
     */
    private PayType payType;

    /**
     * 配送方式
     */
    private DeliveryType deliveryType;


    private CancelReason cancelReason;

    /**
     * 订单留言 备注
     */
    private String memo;

    //购买增值服务个数
    private Integer serviceNum;

    //是否秒杀
    private Boolean seckill;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public BigDecimal getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(BigDecimal totalMoney) {
        this.totalMoney = totalMoney;
    }

    public BigDecimal getPayMoney() {
        return payMoney;
    }

    public void setPayMoney(BigDecimal payMoney) {
        this.payMoney = payMoney;
    }

    public Integer getIntegral() {
        return integral;
    }

    public void setIntegral(Integer integral) {
        this.integral = integral;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getPayTime() {
        return payTime;
    }

    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getAddressDetail() {
        return addressDetail;
    }

    public void setAddressDetail(String addressDetail) {
        this.addressDetail = addressDetail;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public OrderState getOrderState() {
        return orderState;
    }

    public void setOrderState(OrderState orderState) {
        this.orderState = orderState;
    }

    public Date getCancelTime() {
        return cancelTime;
    }

    public void setCancelTime(Date cancelTime) {
        this.cancelTime = cancelTime;
    }


    public PayChannel getPayChannel() {
        return payChannel;
    }

    public void setPayChannel(PayChannel payChannel) {
        this.payChannel = payChannel;
    }

    public String getTransactionNo() {
        return transactionNo;
    }

    public void setTransactionNo(String transactionNo) {
        this.transactionNo = transactionNo;
    }

    public PayType getPayType() {
        return payType;
    }

    public void setPayType(PayType payType) {
        this.payType = payType;
    }

    public DeliveryType getDeliveryType() {
        return deliveryType;
    }

    public void setDeliveryType(DeliveryType deliveryType) {
        this.deliveryType = deliveryType;
    }

    public CancelReason getCancelReason() {
        return cancelReason;
    }

    public void setCancelReason(CancelReason cancelReason) {
        this.cancelReason = cancelReason;
    }


    public BigDecimal getSaveMoney() {
        return saveMoney;
    }

    public void setSaveMoney(BigDecimal saveMoney) {
        this.saveMoney = saveMoney;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public Integer getServiceNum() {
        return serviceNum;
    }

    public void setServiceNum(Integer serviceNum) {
        this.serviceNum = serviceNum;
    }

    public Boolean getSeckill() {
        return seckill;
    }

    public void setSeckill(Boolean seckill) {
        this.seckill = seckill;
    }

    /**
     * 支付渠道
     * @return
     */
    public Integer getPayChannelValue(){
        return (payChannel != null) ? payChannel.getIntValue() : null;
    }

    public void setPayChannelValue(Integer v){
        if(v != null)
            payChannel = PayChannel.getByIntValue(v);
    }

    /**
     * 订单状态
     * @return
     */
    public Integer getOrderStateValue(){
        return (orderState != null) ? orderState.getIntValue() : null;
    }

    public void setOrderStateValue(Integer v){
        if(v != null)
            orderState = OrderState.getByIntValue(v);
    }
    /**
     * 支付方式
     * @return
     */
    public Integer getPayTypeValue(){
        return (payType != null) ? payType.getIntValue() : null;
    }

    public void setPayTypeValue(Integer v){
        if(v != null)
            payType = PayType.getByIntValue(v);
    }

    /**
     * 配送方式
     * @return
     */
    public Integer getDeliveryTypeValue(){
        return (deliveryType != null) ? deliveryType.getIntValue() : null;
    }

    public void setDeliveryTypeValue(Integer v){
        if(v != null)
            deliveryType = DeliveryType.getByIntValue(v);
    }
       /*
       * 取消原因
       * */
    public void setCancelReasonValue(Integer cancelReasonValue){

        if( cancelReasonValue != null)
            cancelReason = CancelReason.getByIntValue(cancelReasonValue);
    }
    public Integer getCancelReasonValue(){
        return  (cancelReason!=null)? cancelReason.getIntValue() : null;
    }
}
